# Contributor: Andre Bierwolf <a.b.bierwolf@gmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=novnc
pkgver=1.4.0
pkgrel=1
pkgdesc="VNC client using HTML5 (WebSockets, Canvas) with encryption (wss://) support"
url="https://novnc.com/"
arch="noarch"
license="MPL-2.0"
depends="net-tools websockify"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/novnc/noVNC/archive/v$pkgver.tar.gz
	alpine-specific-launch.js.patch
	"
builddir="$srcdir/noVNC-$pkgver"
options="!check"

package() {
	mkdir -p "$pkgdir"/usr/share/$pkgname
	cd "$pkgdir"/usr/share/$pkgname

	cp -r "$builddir"/* .

	# Clean up package.
	rm utils/README.md

	# Move license files.
	mkdir -p "$pkgdir"/usr/share/licenses/$pkgname
	mv LICENSE.txt docs/LICENSE.* "$pkgdir"/usr/share/licenses/$pkgname/

	# Move documentation.
	mkdir -p "$pkgdir"/usr/share/doc
	mv docs "$pkgdir"/usr/share/doc/$pkgname
	mv README.md "$pkgdir"/usr/share/doc/$pkgname/

	# Install launch.sh to /usr/bin.
	install -D -m 755 utils/novnc_proxy "$pkgdir"/usr/bin/novnc_server

	# Remove irrelevant utils.
	rm -r utils
}

sha512sums="
b42b0e8c3947dba9a9ba8518bbeb218e77c9d36302c1161f168351ef971c76f3a25e0d136d44e5aa0c6d934290e7d8f23961519e64ca9bdb1eeed8d416aecee3  novnc-1.4.0.tar.gz
7e638cfe492c9657e82e2486f23f3248bc16f7822feca3d31956ae0184f52d63d17c2f630d4a325e838effa84602519b63644f1ae519659bc3bf1817a717c590  alpine-specific-launch.js.patch
"
